﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FlyingHat.Common.Helper
{
    public static class ConvertHelper
    {

        #region 扩展
        public static long ToLong(this string? value)
        {
            if (string.IsNullOrWhiteSpace(value))
                return 0L;
            _ = long.TryParse(value.ToString(), out var result);
            return result;
        }
        public static int ToInt(this object? value)
        {
            if (value == null || value == DBNull.Value)
                return 0;
            _ = int.TryParse(value.ToString(), out var result);
            return result;
        }
        #endregion

    }
}
